package com.itheima.mapper;

import com.itheima.domain.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author:篍
 * @Date: 2025/07/10 10:33
 * @Description:Fighting TODO
 */
@Mapper
public interface DeptMapper {
    /**
     * @return 部门集合
     */

    @Select("select id, name, create_time createTime, update_time updateTime from dept")
    List<Dept> findAll();

    @Delete("delete from dept where id=#{id}")
    Integer deleteDeptById(Integer id);

    @Insert("insert into dept values (#{id},#{name},#{createTime},#{updateTime})")
    Integer addDept(Dept dept);

    @Select("select * from dept where id=#{deptId}")
    Dept findOneDeptById(Integer deptId);

    @Update("update dept set name=#{name},update_time=#{updateTime} where id=#{id}")
    void updateDept(Dept dept);
}
